﻿package org.openChart.sprite.util 
{
	import org.openChart.sprite.elements.Bar2d;
	import flash.events.TimerEvent;
	import flash.utils.Timer;
	
	/**
	 * ...
	 * @author ...
	 */
	public class HeightHelper 
	{
		private var repeatCount:uint = 100;
		private var target:Bar2d;
		private var height_:Number
		
		public function HeightHelper( target:Bar2d, height_:Number, time:Number = 5000) 
		{
			this.target = target;
			target.elementHeight = 0;
			this.height_ = height_;
			var timer:Timer = new Timer( time / 1000, repeatCount);
			timer.start();
			timer.addEventListener(TimerEvent.TIMER, onTick);
			timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerComplete);
		}
		
		public function onTick( event:TimerEvent ):void
		{
			target.elementHeight += height_ / repeatCount;
		}
		
		public function timerComplete( event:TimerEvent ):void
		{
			
		}
	}
	
}